<script setup lang="ts">
import {reactive} from 'vue'
import {getUserInfo, getUserLevel} from '@/api/index'
const userInfo = reactive({
    info: null as any,
    fetchData() {
        return getUserInfo().then((res) => {
            userInfo.info = res
        })
    },
})

const userLevel = reactive({
    info: null as any,
    fetchData() {
        return getUserLevel().then((res) => {
            userLevel.info = res
        })
    },
})
</script>

<template>
    <div>
		<button @click="$router.go(-1)">返回首页</button>
        <div>
            <button @click="userInfo.fetchData">userInfo</button>
            <div>{{ userInfo.info }}</div>
        </div>
        <div>
            <button @click="userLevel.fetchData">userLevel</button>
            <div>{{ userLevel.info }}</div>
        </div>
    </div>
</template>
